package com.freda.oa.flow.run.model.impl;

import com.freda.oa.flow.run.model.itf.FlowPartModelItf;
import com.freda.oa.flow.run.vo.FlowRunInfoVo;
import com.freda.oa.flow.utl.FlowIdHelper;

/**
 * 操作参与者
 * @author Rally
 *
 */
public class FlowPartModelImpl extends FlowBaseModelImpl implements FlowPartModelItf{

	/* (non-Javadoc)
	 * @see com.freda.oa.flow.run.model.impl.FlowPartModelItf#addPart(com.freda.oa.flow.run.vo.FlowRunInfoVo)
	 */
	@Override
	public int addPart(FlowRunInfoVo runInfo)
	{
		
		runInfo.setPartId(FlowIdHelper.getPartId());
		
		g4Dao.insert("FlowPart.add", runInfo);
		
		return 1;
	}
	
	/* (non-Javadoc)
	 * @see com.freda.oa.flow.run.model.impl.FlowPartModelItf#editState(com.freda.oa.flow.run.vo.FlowRunInfoVo)
	 */
	@Override
	public int editState(FlowRunInfoVo runInfo,int state)
	{
		runInfo.setPartState(state);
		
		if(g4Dao.update("FlowPart.updateState", runInfo) != -1)
		{
			return 1;
		}
		else
		{
			return 0;			
		}
	}
}
